<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>博客审批页</title>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <meta name="keywords" content="个人博客,三3三个人博客,个人博客系统,三3三博客">
    <meta name="description" content="三3三王博客系统，一个站在java开发之路上的草根程序员个人博客网站。">
    <LINK rel="Bookmark" href="favicon.ico" >
    <LINK rel="Shortcut Icon" href="../../images/icon.jpg" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="/staticRes/js/html5shiv.js"></script>
    <script type="text/javascript" src="/staticRes/js/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="plugin/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="plugin/Hui-iconfont/1.0.8/iconfont.min.css" />
    <link rel="stylesheet" type="text/css" href="css/common.css" />
    <link rel="stylesheet" type="text/css" href="plugin/pifu/pifu.css" />
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

    <style>
        .shadow_css {
            display: none;
            position: absolute;
            top: 0%;
            left: 0%;
            width: 100%;
            height: 100%;
            background-color: black;
            z-index: 10;
            /* 为mozilla firefox 设置透明度  */
            -moz-opacity: 0.6;
            /* 设置透明度 */
            opacity: .60;
            /* 为IE 设置透明度  */
            filter: alpha(opacity=66);
        }

        .window_css {
            display: none;
            /*border:2px solid black;    !*边框*!*/
            position: fixed;
            top: 20%;
            left: 15%;
            width: 70%;
            height: 70%;
            border: 3px solid black;
            background-color: aliceblue;
            z-index: 11;
        }
    </style>
</head>
<body>
<div class="navbar navbar-fixed-top">
    <div class="container cl">
        <a aria-hidden="false" class="nav-toggle Hui-iconfont visible-xs" href="javascript:void(0);" onclick="showSide();">&#xe667;</a>
        <nav class="nav navbar-nav nav-collapse w_menu" role="navigation">
            <ul class="cl">
                <li class="active"> <a href="/main.html" data-hover="主页面">主页面</a> </li>
                <li class="active"> <a href="/blog/list" data-hover="首页">首页</a> </li>
                <li> <a href="about.html" data-hover="关于我">关于我</a> </li>
                <li> <a href="mood.html" data-hover="碎言碎语">碎言碎语</a> </li>
                <!--                    <li><a href="article.html" data-hover="学无止尽">学无止尽</a></li>-->
                <li> <a href="board.html" data-hover="留言板">留言板</a> </li>
                <li> <a href="writing.html" data-hover="写博客">写博客</a> </li>
                <li> <a href="myBlog.html" data-hover="我的博客">我的博客</a> </li>
            </ul>
        </nav>
        <nav class="navbar-nav navbar-userbar hidden-xs hidden-sm " style="top: 0;">
            <ul class="cl">
                <li class="userInfo dropDown dropDown_hover">
                    <!--<a href="javascript:;" ><img class="avatar radius" src="img/40.jpg" alt="丶似浅 "></a>
                    <ul class="dropDown-menu menu radius box-shadow">
                        <li><a href="/app/loginOut">退出</a></li>
                    </ul>-->
                    <a href="../login.html" onclick="layer.msg('正在通过QQ登入', {icon:16, shade: 0.1, time:0})" ><img class="avatar size-S" src="img/qq.jpg" title="登入">退出</a>
                </li>
            </ul>
        </nav>
    </div>
</div>
</header>
<div class="panel panel-default">
    <!-- Default panel contents -->
    <div class="panel-heading"><h3><font color="#1e90ff">博客列表</font> </h3></div>

    <!-- Table -->
    <table class="table" id="blogTable">
        <tr>
            <th>作者</th>
            <th>博客标题</th>
            <th>提交日期</th>
            <th>状态</th>
            <th>操作</th>
        </tr>
    </table>
    <div id="window" class="window_css">
        <a style="position: fixed;right: 250px" href="javascript:void(0)" onclick="hideWindow()">
            关闭窗口
        </a>
        <div id="window2">

        </div>
    </div>
</div>
<script type="text/javascript" src="plugin/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript" src="plugin/layer/3.0/layer.js"></script>
<script type="text/javascript" src="plugin/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="plugin/pifu/pifu.js"></script>
<script type="text/javascript">

    $(function () {
        getBlogList();
    })

    function getBlogList() {
        let data = {
            type:"0"
        }
        $.ajaxSettings.async = false;//取消异步
        $.getJSON("/blog/approvalBlogList",data, function (data) {
            if (data.data.length == 0 || data.data == null){
                return;
            }
            $.each(data.data, function (i,v) {
                $("#blogTable").append(
                    '<tr><td>' + v.authorName + '</td><td>' + v.title + '</td>' + '</td><td>' + v.createDate + '</td>'
                    + '</td><td>' + v.status + '</td>' + '</td><td><a onclick="getBlogInfo(\'' + v.id + '\')">编辑</a>'
                    + '<a onclick="del(\''+ v.id +'\')">    删除</a><a onclick="getApprovalRate(\''+ v.id +'\',\''+ v.status +'\')">    查看审批进度</a></td></tr>'
                )
            })
        });
    }

    function getBlogInfo(id) {
        location.href = "/blog/editBlog?id=" + id;
    }

    function del(id) {
        var msg = "您真的确定要删除吗？删除之后数据将无法恢复！！！";
        if (confirm(msg)==true){
            delBlogInfo(id)
        }else{
            return false;
        }
    }

    function delBlogInfo(id) {
        let data = {
            id:id
        }
        $.ajax({
            type: 'POST',
            url:"/blog/delBlog",
            data: data,
            async: false,
            success:function (data) {
                if (data.code == 200){
                }else {
                }
            }
        })
        location.reload();
    }

    function getApprovalRate(id,status) {
        if (status == "通过" || status == "未通过"){
            $('#window2').append(
                '<h3><font  style="position: fixed;left: 45%;top: 45%" color="black">审批已完成</font> </h3>'
            );//放到指定的id里
        }else
            {
            let data = {
                id:id
            }
            $.ajax({
                type: 'GET',
                url:"/blog/getApprovalRate",
                data: data,
                async: false,
                success:function (data) {
                    var img = document.createElement('img');//创建一个标签
                    img.setAttribute('src',"/blog/getApprovalRate?id=" + id);//给标签定义src链接
                    document.getElementById('window2').appendChild(img);//放到指定的id里
                }
            })
        }
        displayWindow()
    }

    /*当点击调用此方法后,将悬浮窗口显示出来,背景变暗*/
    function displayWindow() {
        /*悬浮窗口的显示,需要将display变成block*/
        document.getElementById("window").style.display = "block";
        /*将背景变暗*/
        document.getElementById("shadow").style.display = "block";
    }

    /*当点击调用此方法,将悬浮窗口和背景全部隐藏*/
    function hideWindow() {
        $("#window2").empty();
        document.getElementById("window").style.display = "none";
        document.getElementById("shadow").style.display = "none";
    }

</script>
</body>
</html>